package com.sanyue.thread;

import org.junit.Test;

import java.util.concurrent.Callable;

/**
 * @author sanyue
 * @version 1.0
 * @description: TODO
 * @date 2022/2/8 下午4:29
 */
class ThreadStudy {

    // 三种方法
    // 1。继承Thread类
    // 2，3。实现Runnable/Callable接口 重写其中的run/call方法

    class ThreadExtend extends Thread {
        @Test
        public void test() {
            this.start();
        }
    }

    static class ThreadRun implements Runnable {

        @Override
        public void run() {
            System.out.println("Runnable");
        }
    }

    static class ThreadCall<T extends Object> implements Callable<T> {

        @Override
        public T call() throws Exception {
            System.out.println("Callable  -T");
            return null;
        }

    }

}